﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZhouYu.DreamTour.Core;
using ZhouYu.DreamTour.DAL.IRepository;
using ZhouYu.DreamTour.Model;

namespace ZhouYu.DreamTour.DAL.Repository
{
    public class FoodRepository:IFoodRepository
    {
        /// <summary>
        /// 获取餐饮页面信息
        /// </summary>
        /// <returns></returns>
        public List<CaterAccommod> GetCaterAccommodsInfo()
        {
            //sql语句
            string sql = "select * from CaterAccommod";
            sql += " limit 0,5";
            //调用查询集合方法
            List<CaterAccommod> caterAccommodslist = DapperHelper<CaterAccommod>.QueryList(sql, null);
            return caterAccommodslist;
        }


        /// <summary>
        /// 根据Id获取餐饮详情
        /// </summary>
        /// <returns></returns>
        public CaterAccommod GetCaterAccommodsInfoById(int CaterId)
        {
            //sql语句
            string sql = "select * from CaterAccommod where CaterId=@CaterId";
            //创建餐饮对象
            CaterAccommod caterAccommod = new CaterAccommod();
            caterAccommod.CaterId =CaterId;
            //调用查询方法            
            return DapperHelper<CaterAccommod>.QuerySingleOrDefault(sql, caterAccommod);
        }
    }
}
